#include "Timer.hpp"
using namespace std::chrono;
Timer::Timer()
{
    recordTimePoint();
}
void Timer::recordTimePoint()
{
    last_time_point = std::chrono::steady_clock::now();
    this->started = true;
}

long long Timer::getElapsedMilliseconds() const
{
    if (!started)
        return 0;
    return duration_cast<milliseconds>(steady_clock::now() - last_time_point).count();
}

int64_t Timer::getElapsedSeconds() const
{
    if (!started)
        return 0;
    return duration_cast<seconds>(steady_clock::now() - last_time_point).count();
}

double Timer::getElapsedDoubleSeconds() const
{
    if (!started)
        return 0;
    return duration_cast<milliseconds>(steady_clock::now() - last_time_point).count()/1000.f;
}

bool Timer::isStarted() const
{
    return this->started;
}
